package com.lg.atp.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lg.atp.dao.TestTaskReportDao;
import com.lg.atp.entity.TestTaskReport;
import com.lg.atp.service.IReportService;

@Service("iReportService")
public class ReportServiceImpl implements IReportService{

	@Autowired
	private TestTaskReportDao testTaskReportDao;
	
	@Override
	public Map<String,List<TestTaskReport>> selectRunReport() {
		
		List<TestTaskReport> list = testTaskReportDao.selectRunReport();
		Map<String,List<TestTaskReport>> map = new HashMap<String,List<TestTaskReport>>();
		for(TestTaskReport report:list) {
			String key = report.getTaskId()+"-"+report.getTaskName();
			List<TestTaskReport> sublist = map.get(key);
			if(sublist == null) {
				sublist = new ArrayList<TestTaskReport>();
				map.put(key, sublist);
			}
			sublist.add(report);
		}
		return map;
	}

}
